import os, sys, time
import threading, traceback

parent_path = os.path.abspath(os.path.join(__file__, *([".."] * 5)))
sys.path.insert(0, parent_path)

from core.task.modules.task_lines.base_task import BaseTask


class LineTask(BaseTask):
    """任务流程, 必定包含predictor"""

    def __init__(
        self, predictor, process, preprocess, postprocess, detector_tags=[]
    ) -> None:
        super().__init__(predictor, process, preprocess, postprocess, detector_tags)

    def __call__(self, data):
        self.standby()
        self.status = 2
        data["detector_tags"] = self.detector_tags
        for processor in self.exe_seq:
            data = processor(data)
        # data["task_done"] = True
        self.status = 0
        return data
